package leecode

import "sort"

type byString []string

func (b byString) Len() int {
	return len(b)
}

func (b byString) Swap(i, j int) {
	b[i], b[j] = b[j], b[i]
}

func (b byString) Less(i, j int) bool {
	if len(b[i]) < len(b[j]) {
		return true
	} else if len(b[i]) > len(b[j]) {
		return false
	}
	return b[i] < b[j]
}

func kthLargestNumber(nums []string, k int) string {
	sort.Sort(byString(nums))
	return nums[len(nums)-k]
}
